package com.zxjia.ssmp.doc;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;

@Document(indexName = "ssmp-product", shards = 3, replicas = 1)
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class ProductDoc  {

    @Id
    private Integer id;

    @Field(type = FieldType.Keyword)
    private Integer productCateId;

    @Field(type = FieldType.Text,analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
    private String productName;

    @Field(type = FieldType.Keyword)
    private String sku;

    @Field(type = FieldType.Keyword, index = false)
    private String imgUrl;

    @Field(type = FieldType.Keyword , index = false)
    private Integer stock;

    @Field(type = FieldType.Keyword, index = false)
    private Integer sales;

    @Field(type = FieldType.Double)
    private BigDecimal mallMobilePrice;

    @Field(type = FieldType.Double)
    private BigDecimal originalPrice;

    @Field(type = FieldType.Keyword , index = false)
    private String description;
}